package calao.contact.client;

import calao.client.ui.HasTitle;
import calao.client.ui.SpacerPanel;
import calao.client.ui.TabPanel;

public class ContactPanel
extends SpacerPanel
implements HasTitle
{
	
	final TabPanel formPanel = new TabPanel();
	final ContactForm contactForm;
	
	ContactPanel(Contact info, int action, boolean editable)
	{
		super(VERTICAL);
		contactForm = new ContactForm(info, action, editable);
		formPanel.newTab(ContactMod.instance.text.contact(), contactForm);
		this.setTitle(contactForm.getTitle());
		add(formPanel);
		if (info instanceof Organization) {
			add(new ContactTable((Organization)info));
		}
		setWidth("100%");
	}

	public ContactForm getContactForm()
	{
		return contactForm;
	}
	
	public TabPanel getFormPanel()
	{
		return formPanel;
	}
	
}
